import firedrake
/home/firedrake/firedrake/lib/python3.10/site-packages/pytools/__init__.py:2428: UserWarning: unable to find git revision
warn("unable to find git revision")
/home/firedrake/firedrake/src/loopy/loopy/schedule/__init__.py:2201: UserWarning: pytools.persistent_dict 'loopy-schedule-cache-v4-2024.1-islpy2024.1-cgen2020.1-967461ba9c3677ee6f0334b9ee95ef0f0e51d208-v1': enabling safe_sync as default. This provides strong protection against data loss, but can be unnecessarily expensive for use cases such as caches.Pass 'safe_sync=False' if occasional data loss is tolerable. Pass 'safe_sync=True' to suppress this warning.
schedule_cache = WriteOncePersistentDict(
/home/firedrake/firedrake/src/loopy/loopy/tools.py:914: UserWarning: pytools.persistent_dict 'loopy-memoize-cache-buffer_array-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.1-cgen2020.1-967461ba9c3677ee6f0334b9ee95ef0f0e51d208-v1': enabling safe_sync as default. This provides strong protection against data loss, but can be unnecessarily expensive for use cases such as caches.Pass 'safe_sync=False' if occasional data loss is tolerable. Pass 'safe_sync=True' to suppress this warning.
transform_cache = WriteOncePersistentDict(
/home/firedrake/firedrake/src/loopy/loopy/tools.py:914: UserWarning: pytools.persistent_dict 'loopy-memoize-cache-preprocess_program-LoopyKeyBuilder.LoopyKeyBuilder-v0-2024.1-islpy2024.1-cgen2020.1-967461ba9c3677ee6f0334b9ee95ef0f0e51d208-v1': enabling safe_sync as default. This provides strong protection against data loss, but can be unnecessarily expensive for use cases such as caches.Pass 'safe_sync=False' if occasional data loss is tolerable. Pass 'safe_sync=True' to suppress this warning.
transform_cache = WriteOncePersistentDict(
/home/firedrake/firedrake/src/loopy/loopy/codegen/__init__.py:313: UserWarning: pytools.persistent_dict 'loopy-code-gen-cache-v3-2024.1-islpy2024.1-cgen2020.1-967461ba9c3677ee6f0334b9ee95ef0f0e51d208-v1': enabling safe_sync as default. This provides strong protection against data loss, but can be unnecessarily expensive for use cases such as caches.Pass 'safe_sync=False' if occasional data loss is tolerable. Pass 'safe_sync=True' to suppress this warning.
code_gen_cache = WriteOncePersistentDict(
/home/firedrake/firedrake/src/loopy/loopy/target/execution.py:724: UserWarning: pytools.persistent_dict 'loopy-typed-and-scheduled-cache-v1-2024.1-islpy2024.1-cgen2020.1-967461ba9c3677ee6f0334b9ee95ef0f0e51d208-v1': enabling safe_sync as default. This provides strong protection against data loss, but can be unnecessarily expensive for use cases such as caches.Pass 'safe_sync=False' if occasional data loss is tolerable. Pass 'safe_sync=True' to suppress this warning.
typed_and_scheduled_cache = WriteOncePersistentDict(
/home/firedrake/firedrake/src/loopy/loopy/target/execution.py:732: UserWarning: pytools.persistent_dict 'loopy-invoker-cache-v10-2024.1-islpy2024.1-cgen2020.1-967461ba9c3677ee6f0334b9ee95ef0f0e51d208-v1': enabling safe_sync as default. This provides strong protection against data loss, but can be unnecessarily expensive for use cases such as caches.Pass 'safe_sync=False' if occasional data loss is tolerable. Pass 'safe_sync=True' to suppress this warning.
invoker_cache = WriteOncePersistentDict(
import viskex
import common_firedrake as common # isort: skip
Generate meshes of the unit cube by dividing each edge of the cube in 6 segments, using either a tetrahedral or hexahedral mesh.
cube_tetra = firedrake.UnitCubeMesh(6, 6, 6, hexahedral=False)
cube_hexa = firedrake.UnitCubeMesh(6, 6, 6, hexahedral=True)
Interpolate the vector field $(x^3 + y^2 + z^4, x^6 + y^5 + z^7, x^9 + y^8 + z^{10})$, and store it either in a dolfinx function or a UFL expression.
cube_tetra_vector_field, cube_tetra_vector_field_ufl = common.prepare_vector_field_cases(
cube_tetra, lambda x: (x[0]**3 + x[1]**2 + x[2]**4, x[0]**6 + x[1]**5 + x[2]**7, x[0]**9 + x[1]**8 + x[2]**10))
cube_hexa_vector_field, cube_hexa_vector_field_ufl = common.prepare_vector_field_cases(
cube_hexa, lambda x: (x[0]**3 + x[1]**2 + x[2]**4, x[0]**6 + x[1]**5 + x[2]**7, x[0]**9 + x[1]**8 + x[2]**10))
Plot the vector field with a contour plot.
viskex.firedrake.plot_vector_field(cube_tetra_vector_field, "vector")
viskex.firedrake.plot_vector_field(cube_tetra_vector_field_ufl, "vector")
# PYTEST_XFAIL: Temporarily broken due to firedrake#3315
"""Expect this cell to fail.
viskex.firedrake.plot_vector_field(cube_hexa_vector_field, "vector")
"""
'Expect this cell to fail.\n\nviskex.firedrake.plot_vector_field(cube_hexa_vector_field, "vector")\n'
# PYTEST_XFAIL: Temporarily broken due to firedrake#3315
"""Expect this cell to fail.
viskex.firedrake.plot_vector_field(cube_hexa_vector_field_ufl, "vector")
"""
'Expect this cell to fail.\n\nviskex.firedrake.plot_vector_field(cube_hexa_vector_field_ufl, "vector")\n'
Plot the vector field with a quiver plot.
viskex.firedrake.plot_vector_field(cube_tetra_vector_field, "vector", glyph_factor=0.1)
# PYTEST_XFAIL: Temporarily broken due to firedrake#3315
"""Expect this cell to fail.
viskex.firedrake.plot_vector_field(cube_hexa_vector_field, "vector", glyph_factor=0.1)
"""
'Expect this cell to fail.\n\nviskex.firedrake.plot_vector_field(cube_hexa_vector_field, "vector", glyph_factor=0.1)\n'
Apply the vector field as a deformation to the mesh.
viskex.firedrake.plot_vector_field(cube_tetra_vector_field, "vector", warp_factor=1.0)
# PYTEST_XFAIL: Temporarily broken due to firedrake#3315
"""Expect this cell to fail.
viskex.firedrake.plot_vector_field(cube_hexa_vector_field, "vector", warp_factor=1.0)
"""
'Expect this cell to fail.\n\nviskex.firedrake.plot_vector_field(cube_hexa_vector_field, "vector", warp_factor=1.0)\n'